package com.yundingai.domain.vo;

import com.yundingai.domain.entity.AllMenu;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: liyuxiang
 * @Date: 2025/7/26 13:42
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class MenuVo {
    private Integer menuId;
    private Integer parentId;
    private String name;
    private String path;
    private String redirect;
    private String component;
    private String query;
    private Boolean alwaysShow;
    private MetaVo meta;
    private List<MenuVo> children = new ArrayList<>();

    public MenuVo(AllMenu menu) {
        this.menuId = menu.getMenuId();
        this.parentId = menu.getParentId();
        this.name = menu.getMenuTitle();
        this.path = menu.getMenuHref();
        this.component = menu.getMenuComp();
        this.meta = new MetaVo(menu.getMenuTitle(), menu.getMenuIcon());
    }
}